package com.jxtc.enterprise.common.constants;

import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Getter
public enum CompanySettlementStatusEnum {

    NOT_SETTLED("未结算", 10),
    PENDING_HR_CONFIRMATION("待 HR 确认", 20),
    PENDING_PLATFORM_CONFIRMATION("待平台复核", 30),
    PENDING_SETTLEMENT("待结算", 40),
    SETTLED("已结算", 50);

    private final String name;
    private final int value;

    CompanySettlementStatusEnum(String name, int value) {
        this.name = name;
        this.value = value;
    }

    /**
     * 将枚举值转换成列表
     */
    public static List<Map<String, Object>> toList() {
        List<Map<String, Object>> list = new ArrayList<>();
        for (CompanySettlementStatusEnum status : CompanySettlementStatusEnum.values()) {
            Map<String, Object> map = new HashMap<>();
            map.put("statusName", status.getName());
            map.put("statusValue", status.getValue());
            list.add(map);
        }
        return list;
    }

    public static String getNameByValue(int value) {
        for (CompanySettlementStatusEnum status : CompanySettlementStatusEnum.values()) {
            if (status.getValue() == value) {
                return status.getName();
            }
        }
        return null;
    }
}
